window.onload=function(){
	$(".dealerManage").css("backgroundColor","#224247").siblings().css("backgroundColor","#365d62");
	//日期控件
	layui.use('laydate', function(){
	  	var element =laydate = layui.laydate
	})
	//查询
	$(".dealerQueryBtn").click(function(){
		var after_date=$("#startDate").val();
		var before_date=$("#endDate").val();
		var writeContent = $(".dealerBox").val();
		if($("#startDate").val()==""&$("#endDate").val()==""&writeContent!=""){
			if(writeContent=="%"){
				alert("非法输入，请正确输入用户名！");
			}else{
				window.location.href='/admin/device/chargeRecords/dealer?dealer='+writeContent;
			}
		}else if($("#startDate").val()!=""&$("#endDate").val()!=""&writeContent!=""){
			window.location.href='/admin/device/chargeRecords/dealer?dealer='+writeContent+'&after_date='+after_date+'&before_date='+before_date;
		}else if($("#startDate").val()!=""&$("#endDate").val()!=""&writeContent==""){
			window.location.href='/admin/device/chargeRecords/dealer?after_date='+after_date+'&before_date='+before_date;
		}else{
			hint("请输入有效搜索时间段或输入经销商");
		}
	});
	//导出
	$(".exportBtn").click(function(){
		var after_date=$("#startDate").val();
		var before_date=$("#endDate").val();
		var writeContent = $(".dealerBox").val();
		if($("#startDate").val()==""&$("#endDate").val()==""&writeContent==""){
			window.location.href='/admin/device/chargeRecords/export';
		}else if($("#startDate").val()==""&$("#endDate").val()==""&writeContent!=""){
			if(writeContent=="%"){
				alert("非法输入，请正确输入用户名！");
			}else{
				window.location.href='/admin/device/chargeRecords/export?dealer='+writeContent;
			}
		}else if($("#startDate").val()!=""&$("#endDate").val()!=""&writeContent!=""){
			window.location.href='/admin/device/chargeRecords/export?dealer='+writeContent+'&after_date='+after_date+'&before_date='+before_date;
		}else if($("#startDate").val()!=""&$("#endDate").val()!=""&writeContent==""){
			window.location.href='/admin/device/chargeRecords/export?after_date='+after_date+'&before_date='+before_date;
		}else{
			alert("请输入有效搜索时间段或输入经销商");
		}
	});
	
}
	